package com.cytech.cloudclinic.moudle.updatepsw;

import com.cytech.cloudclinic.base.BaseBean;
import com.cytech.cloudclinic.base.BaseObserver;
import com.cytech.cloudclinic.base.BasePresenter;
import com.cytech.cloudclinic.bean.UserInfo;
import com.yechaoa.yutils.ToastUtil;

public class UpdatePasswordPresenter extends BasePresenter<UpdatePasswordView> {

    public UpdatePasswordPresenter(UpdatePasswordView baseView) {
        super(baseView);
    }

    /**
     * 修改密码
     */
    void login(String name,String password) {
        UserInfo userInfo = new UserInfo(name,password);
        addDisposable(apiServer.updatePassword(objectToRequestBody(userInfo)), new BaseObserver<BaseBean<UserInfo>>(baseView, true) {

            @Override
            public void onSuccess(BaseBean<UserInfo> o) {
                //baseView.loginSuccess(o.result.token);
            }

            @Override
            public void onError(String msg) {
                ToastUtil.showToast(msg);
            }
        });
    }
}
